package com.wx.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Aspect  
public class AdminLoginInterceptor {  
	
	private Logger logger = LoggerFactory.getLogger(getClass());
	
    @Pointcut("execution(* com.bird.service.impl.PersonServiceBean.*(..))")  
    private void anyMethod(){}//定义一个切入点  
      
    @Before("anyMethod() && args(name)")  
    public void doAccessCheck(String name){  
    	logger.info(name);  
        logger.info("前置通知");  
    }  
      
    @AfterReturning("anyMethod()")  
    public void doAfter(){  
        logger.info("后置通知");  
    }  
      
    @After("anyMethod()")  
    public void after(){  
        logger.info("最终通知");  
    }  
      
    @AfterThrowing("anyMethod()")  
    public void doAfterThrow(){  
        logger.info("例外通知");  
    }  
      
    @Around("anyMethod()")  
    public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable{  
        logger.info("进入环绕通知");  
        Object object = pjp.proceed();//执行该方法  
        logger.info("退出方法");  
        return object;  
    }  
}  